#include "epolls.h"
#include "debug.h"
#include "typedef.h"

int epoll_creates(int max)
{
	int fd;
	fd = epoll_create(max);
	return fd;
}

int epoll_ops(int ep_fd, int ep_func, int sock_fd, struct epoll_event *ev)
{
	if(NULL == ev || INVALID_SOCKET == sock_fd) {
		P2P_ERROR("epoll_ops failed!");
		return -1;
	}
	
	epoll_ctl(ep_fd, ep_func, sock_fd, ev);
	return 0;
}

int epoll_loops(int ep_fd, struct epoll_event *evs, int ev_nums, int tm_out)
{
	if(NULL == evs) {
		P2P_ERROR("epoll_ops failed!");
		return -1;
	}
	
	int nums = 0;
	nums = epoll_wait(ep_fd, evs, ev_nums, tm_out);
	return nums;
}
